MAPS
Photo by Melissa Askew on Unsplash
Life is a journey that must be traveled no matter how bad the roads and accommodations…
— Oliver Goldsmith
Administrative boundaries at levels adm0, adm1, adm2, and road lines
# Load map sources
# ++++++++++++++++++++
# using the same map sources up to adm2 which contains info of area of district in each region in Uganda
adm0 <- st_read("archetypes/uganda/uganda-adm0.geojson")
## Reading layer `uganda-adm0' from data source
## `C:\Users\jaybe\Desktop\kamino-public\kamino-source\sources\10-maps\1-map-making\4-vector\archetypes\uganda\uganda-adm0.geojson'
## using driver `GeoJSON'
## Simple feature collection with 1 feature and 10 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 29.57216 ymin: -1.481474 xmax: 35.00105 ymax: 4.231367
## Geodetic CRS: WGS 84
adm1 <- st_read("archetypes/uganda/uganda-adm1.geojson")
## Reading layer `uganda-adm1' from data source
## `C:\Users\jaybe\Desktop\kamino-public\kamino-source\sources\10-maps\1-map-making\4-vector\archetypes\uganda\uganda-adm1.geojson'
## using driver `GeoJSON'
## Simple feature collection with 4 features and 12 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 29.57216 ymin: -1.481474 xmax: 35.00105 ymax: 4.231367
## Geodetic CRS: WGS 84
adm2 <- st_read("archetypes/uganda/uganda-adm2.geojson")
## Reading layer `uganda-adm2' from data source
## `C:\Users\jaybe\Desktop\kamino-public\kamino-source\sources\10-maps\1-map-making\4-vector\archetypes\uganda\uganda-adm2.geojson'
## using driver `GeoJSON'
## Simple feature collection with 135 features and 14 fields
## Geometry type: MULTIPOLYGON
## Dimension: XY
## Bounding box: xmin: 29.57216 ymin: -1.481474 xmax: 35.00105 ymax: 4.231367
## Geodetic CRS: WGS 84
head(as.data.frame(adm0))
head(as.data.frame(adm1))
head(as.data.frame(adm2))
df_road_lines <- st_read("archetypes/uganda/unra_road_network.geojson")
## Reading layer `UNRA_road_network' from data source
## `C:\Users\jaybe\Desktop\kamino-public\kamino-source\sources\10-maps\1-map-making\4-vector\archetypes\uganda\unra_road_network.geojson'
## using driver `GeoJSON'
## Simple feature collection with 890 features and 11 fields (with 6 geometries empty)
## Geometry type: MULTILINESTRING
## Dimension: XY, XYZ
## Bounding box: xmin: 3293167 ymin: -163664.7 xmax: 3896404 ymax: 423995
## z_range: zmin: 0 zmax: 2453.817
## Projected CRS: WGS 84 / Pseudo-Mercator
head(as.data.frame(df_road_lines))
theme_opts <- theme(
legend.position = "none",
legend.title = element_blank(),
axis.text = element_blank(),
axis.line = element_blank(),
axis.ticks = element_blank(),
axis.title = element_blank(),
panel.grid = element_blank(),
panel.grid.major = element_blank(),
panel.grid.minor = element_blank(),
# panel.background = element_blank(),
panel.background = element_rect(fill = "#ffffff"),
panel.border = element_blank(),
# plot.background = element_blank(),
plot.background = element_rect(fill = "#ffffff")
)
transparent_fill <- rgb(0, 0, 0, max = 255, alpha = 0, names = "transparent")
# In order of layer placement top -> down
# using adm0 map sources which contains info of area of the country
v1 <- ggplot() +
geom_sf(data = adm0, color="#333333", fill = transparent_fill, size=2.0) +
geom_sf(data = adm1, color="#333333", fill = transparent_fill, size=1.5) +
geom_sf(data = adm2, color="#333333", fill = transparent_fill, size=1.0) +
scale_x_continuous() +
scale_y_continuous() +
coord_sf() +
theme_bw() +
labs(x = NULL, # Longitude
y = NULL, # Latitude
title = NULL,
subtitle = NULL) +
theme_opts
girafe(ggobj = v1, width_svg = 16, height_svg = 9,
options = list(opts_sizing(rescale = TRUE, width = 1.0)))